home *** CD-ROM | disk | FTP | other *** search
/ MacAddict 4 / MacAddict_004_1996_12.iso / Sponsors / Bungie / Abuse Demo / lisp / general.lsp < prev    next >
Lisp/Scheme  |  1996-08-01  |  4KB  |  157 lines

  1. ;; Copyright 1995 Crack dot Com,  All Rights reserved
  2. ;; See licensing information for more details on usage rights
  3.  
  4. (defun pusher_cons () (set_aistate 4))
  5. (defun pusher_ai ()
  6.   (if (or (eq (total_objects) 0) (not (eq (with_object (get_object 0) (aistate)) 0)))
  7.       (progn
  8.     (next_picture)
  9.     (if (touching_bg)
  10.         (let ((xamount
  11.            (if (> (direction) 0)
  12.                (aistate)
  13.              (- 0 (aistate)))))
  14.           (with_object (bg) (try_move xamount 0)))))) T)
  15.  
  16.  
  17. (def_char PUSHER
  18.   (range 5 5)
  19.   (funs (ai_fun      pusher_ai)
  20. ;    (draw_fun    dev_draw)
  21.     (constructor pusher_cons))
  22.   (fields ("aistate" pusher_speed))
  23.   (states "art/chars/push.spe"
  24.       (stopped (seq "push" 1 5))))
  25.  
  26. (defun spring_cons () (set_yvel -15))
  27. (defun spring_ai () 
  28.   (if (or (eq (total_objects) 0) (not (eq (with_object (get_object 0) (aistate)) 0)))
  29.       (select (aistate)
  30.           (0
  31.            (if (touching_bg)
  32.            (let ((add_yvel (yvel)))
  33.              (play_sound SPRING_SOUND 127 (x) (y))
  34.              (with_object (bg) 
  35.                   (progn
  36.                 (set_yvel (+ (yvel) add_yvel))
  37.                 (if (eq (gravity) 0)
  38.                     (progn
  39.                       (set_state run_jump)
  40.                       (set_gravity 1)))))
  41.          (set_state running)
  42.          (set_aistate 1))))
  43.       (1 (if (next_picture) nil
  44.            (progn
  45.          (set_aistate 0)
  46.          (set_state stopped))))))
  47.   T)
  48.  
  49.  
  50.  
  51. (def_char SPRING
  52.   (range 5 5)
  53.   (funs (ai_fun      spring_ai)
  54.     (constructor spring_cons))
  55.   (fields ("yvel" spring_yvel))
  56.   (states "art/misc.spe"
  57.       (stopped "spri0004.pcx")
  58.       (running (rep "spri0001.pcx" 4))))
  59.  
  60. (defun pr_draw () 
  61.   (draw_predator)
  62.  
  63.   )
  64.   
  65.  
  66. (defun train_ai ()
  67.   (if (eq (aistate) 0)
  68.       (if (activated)
  69.       (let ((type (aitype)))
  70.         (with_object (bg)
  71.                          (if (local_player)    
  72.                              (progn                              
  73.                                (play_sound (aref voice_hints type))
  74.                                ;(expire_cache_item (aref voice_hints type))
  75.                                (show_help (get_train_msg type))
  76.                                  )))
  77.         (set_aistate 1)
  78.         T)
  79.     T)
  80.     (if (eq (aistate) 100)
  81.     nil
  82.       (progn
  83.     (if (with_object (bg) (local_player))
  84.         (show_help (get_train_msg (aitype))))
  85.     (set_aistate (+ (aistate) 1))
  86.     T))))
  87.  
  88.  
  89. (def_char TRAIN_MSG
  90.   (funs (ai_fun train_ai)
  91.     (draw_fun dev_draw))
  92.   (fields ("aitype" train_msg_num))
  93.   (states "art/misc.spe"
  94.       (stopped "bubble")))
  95.     
  96. (defun sball_damage (amount from hitx hity push_xvel push_yvel)  ; transfer damage to lower half
  97.   (if (eq (state) stopped)
  98.       (progn
  99.     (set_aistate 1)
  100.     (set_state running))))
  101.  
  102.  
  103. (def_char SWITCH_BALL
  104.   (funs (damage_fun sball_damage)
  105.     (ai_fun do_nothing))
  106.   (flags (hurtable T))
  107.   (states "art/misc.spe" 
  108.       (stopped (seq "swit" 1 9))
  109.       (running (seq "swit" 10 18))))
  110.  
  111. (def_char POINTER
  112.   (funs (ai_fun do_nothing))
  113.   (states "art/misc.spe"
  114.       (stopped "pointer")))
  115.  
  116. (defun shifter_cons () 
  117.   (set_xvel 300) 
  118.   (set_yvel 300) 
  119.   (set_xacel 0) 
  120.   (set_yacel -1))
  121.  
  122. (defun holder_ai ()
  123.   (select (total_objects)
  124.       (2 
  125.        (let ((newx (+ (with_object (get_object 1) (x)) (xvel)))
  126.          (newy (+ (with_object (get_object 1) (y)) (yvel))))
  127.          (with_obj0 (set_x newx) (set_y newy))
  128.          (set_x newx)
  129.          (set_y newy)
  130.          T))
  131.       (3  
  132.        (if (with_object (get_object 2) (not (eq (aistate) 0)))
  133.            (let ((newx (+ (with_object (get_object 1) (x)) (xvel)))
  134.              (newy (+ (with_object (get_object 1) (y)) (yvel))))
  135.          (with_obj0 (set_x newx) (set_y newy))
  136.          (set_x newx)
  137.          (set_y newy)
  138.          T)
  139.          (if (eq (xacel) 1) 
  140.          nil
  141.            T)))
  142.       (4 T)
  143.       (5 T)
  144.       (6 T)
  145.       (0 nil)
  146.       (1 nil)))
  147.   
  148.  
  149. (def_char OBJ_HOLDER
  150.   (funs (ai_fun holder_ai)
  151.     (draw_fun dev_draw))
  152.   (fields ("xvel"  obj_holder_xoff)
  153.       ("yvel"  obj_holder_xoff)
  154.       ("xacel" obj_holder_del))
  155.   (states "art/misc.spe"
  156.       (stopped "o_hold")))
  157.